/**
 * 权限控制
 */
//模拟按钮权限数据
import { getMenus } from '@/store/getters'
import { useMemo } from 'react'
import { useSelector } from 'react-redux'
import { MenuBtn } from '@/model/route'
export const useAuth = (authPath: string) => {
  const menus: MenuBtn[] = useSelector(getMenus)
  const auth: boolean = useMemo(() => {
    const result = menus.filter(
      (item) => item.routePath === authPath
    )
    if (result.length) {
      return true
    } else {
      return false
    }
  }, [authPath])
  return auth
}
